#include<bits/stdc++.h>

using namespace std;

int main() {
    //freopen("E.in", "r", stdin);
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n, 0));
    int j = 0, i = 0;
    int x, y;

    while (cin >> x >> y) {
        i += y;
        while (y--) {
            a[j / n][j % n] = x;
            j++;
            if (j >= n * n)break;
        }
        if (i >= n * n)break;
        if (x == 0 && y == 0) {
            break;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}